package safe.yunchexing.com.cloudsafe.login;

import android.content.Intent;

import safe.yunchexing.com.cloudsafe.model.request.TestLoginReq;
import safe.yunchexing.com.cloudsafe.model.response.TestLoginRes;
import safe.yunchexing.com.cloudsafe.mvp.BasePresenter;
import safe.yunchexing.com.cloudsafe.server.CallBackAdapter;
import safe.yunchexing.com.cloudsafe.utils.log.Logger;

/**
 * Created by lixiaoming on 16/4/5.
 */
public class LoginPresenter extends BasePresenter<ILoginUI> {


    /*
    * 李小明
    * 请求登录
    * **/
    public void login(TestLoginReq testLoginReq) {
        Http.requestLogin(testLoginReq, new CallBackAdapter<TestLoginRes>() {
            @Override
            public void onSuccess(TestLoginRes body) {
                Logger.i("lxm", "success == " + body.getItem().getToken());
                getUI().startMainTabActivity();
            }

            @Override
            public void onFailure(int errCode) {
                Logger.i("lxm", "failure");
            }
        });
    }


}
